<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>交换两个变量的值</title>
    <script>
        //定义两个变量 
        //定义一个中间变量item
        //将变量1的值赋给中间变量 再将变量2的值赋给变量1 最后将中间变量的值赋给变量2
        //输出两个变量的值
        var num1 = 'apple',
            num2 = 'pear';
        var temp;
        temp = num1;
        num1 = num2;
        num2 = temp;
        console.log(num1);
        console.log(num2);


    </script>
</head>
<body>
    
</body>
</html>